﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
public partial class HomePage_InfoList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public string WriteInfo()
    {
        int i = 0;
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "Info";
        dbPage.Key = "InfoId";
        dbPage.Where = "";
        dbPage.SelectField = "InfoId,Title,AddDate  "; ;
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);
        dbPage.PageSize = 24;
        dbPage.OrderBy = "InfoId";
        dbPage.OrderByIsDesc =true ;
        System.Data.IDataReader dr = dbPage.ExecuteReader();
        sb.Append("<table  width='96%' border=0 align=center cellpadding=6 cellspacing=1>");
        while (dr.Read())
        {
            i++;
            sb.Append("<tr><td class='dotbottomline'>");
            sb.Append("<img src='../images/ico7.gif' width='8' height='5' hspace='4' vspace='1'>");
            sb.Append("<a href='../Manage/info.aspx?InfoID=" + dr["InfoId"].ToString() + "' target=_blank>" + dr["Title"].ToString() + "(" + Convert.ToDateTime(dr["AddDate"].ToString()).ToShortDateString() + ")</a>");
            if (System.DateTime.Now <= Convert.ToDateTime(dr["AddDate"].ToString()).AddDays(2))
                sb.Append("<img src='../images/new.gif' width='28' height=11>");
            sb.Append("</td></tr>");
        }
        for (int j = i; j < 24; j++)
            sb.Append("<tr><td class='dotbottomline'>&nbsp;</td></tr>");

        sb.Append("</table>");
        dr.Close();
        dr.Dispose();
        dbPage.Db.Close();
        db.Close();

        this.DbPageFlip1.DbPage = dbPage;

        return sb.ToString();
    }
}
